package main

import (
	"container/list"
	"fmt"
	"sync"
)

type Brand struct {
}

func (t Brand) show() {
	fmt.Println("商标")

}
//命令行
func main() {
	str := `
gan
long
tou
`
	str1 := "长歌无敌"
	var b Brand
	var a = 1
	//var sl []int
	var cstr []string
	var strs [2]string
	var strs2 = [...]string{"he", "is", "6"}
	strs[0] = "first"
	strs[1] = "second"
	b.show()
	fmt.Println(a, str, str1[1:], strs, strs2)
	cstr = append(cstr, strs2[:]...) //注意切片和数组的区别
	var copstr = []string{"cs", "ds"}
	copy(copstr, strs[:1])
	//for i , v:= range strs{
	//	println(i,v,len(sl))
	//}
	strs[1] = "2"
	fmt.Println(cstr, copstr)
	scene := make(map[string]int)
	scene["route"] = 66
	fmt.Println(scene["route"])
	v := scene["route2"]
	fmt.Println(v)
	scene["br"] = 960
	delete(scene, "br")
	scene = make(map[string]int)
	var _ int
	for i, v := range scene {
		fmt.Println(i, v)
	}
	var sc sync.Map
	sc.Store("gr", 255)
	fmt.Println(sc.Load("gr"))
	sc.Range(func(k, v interface{}) bool {
		fmt.Println("in:", k, v)
		return true

	})
	var li list.List
	li2 := list.New()
	e := li.PushBack(1)
	li2.PushFront(2)
	fmt.Println(li, li2)
	li.PushBackList(li2)
	li.InsertAfter("q", e)
	ad := &a
	//j := li.Front()
	//k :=&j
	for i := li.Front(); i != nil; i = i.Next() {
		fmt.Println(i, i.Value)
		fmt.Printf("%T %p\n", i, ad)
	}
	if a := 9; a < 7 {
		print("dsvm")
	} else if a < 8 {
		print("Hkdvs")

	} else if a < 10 {
		print("ok")
	}
	str = "eifncjkrdvn"
	sc2 := str[:]
	fmt.Println(sw())
	str2s :=[3]string{"hsiudfv","fdkl","vdnjkv"}
	ssc :=str2s[:]
	ssc[0]="sbdbnjddddd"
	ss2 := ssc[:]
	ssc = append(ssc,"dsvjkskvfkjd","dkvjsvnkjfdbvhfd")

	ssc[0] = "iwejs"
	fmt.Printf("%v,%v,%v,%T\n",ssc,ss2,str2s,sc2)
	var invoker Invoker
	s := new(Struct)
	invoker =s
	invoker.Call("hello")
	invoker = f(func(p string){
		fmt.Println(p)
	})//将匿名函数强转
invoker.Call("dcnj")
}
type f func(string)
type Invoker interface {
	Call(string)
}
type Struct struct {

}

func (f1 f) Call(string2 string)  {
	f1(string2)
}
func (s *Struct) Call(string2 string)  {
	fmt.Println("from struct",string2)
}
func sw() (a int,b int) {
	a = 1
	b = 2
	return
}
